#ifndef PROJECT_HXX
#define PROJECT_HXX

#include <QMetaType>
#include <string>
#include <vector>

#pragma execution_character_set("utf-8")

class Sequence;
class VideoView;

enum ProjectType
{
    TYPE_RECTANGLE = 0,
    TYPE_FISH,
    TYPE_POLYGON
};

class Class
{
public:
    Class() { _id = -1; }

    inline void setId(int id) { _id = id; }
    inline int getId() { return _id; }

    inline void setName(std::string name) { _name = name; }
    inline std::string getName() { return _name; }

private:
    int _id;
    std::string _name;
};

Q_DECLARE_METATYPE(Class*)

class Project
{
public:
    Project();
    ~Project();

    void setName(std::string name) { _name = name; }
    inline std::string getName() { return _name; }

    void setProjectType(std::string typeName);
    std::string getProjectTypeName();
    inline void setProjectType(ProjectType pt) { _projectType = pt; }
    inline ProjectType getProjectType() { return _projectType; }

    inline Sequence* getActiveSequence() { return _activeSequence; }
    inline void setActiveSequence(Sequence* sequence) { _activeSequence = sequence; }

    inline Class* getActiveClass() { return _activeClass; }
    inline void setActiveClass(Class* cls) { _activeClass = cls; }

    inline std::vector<Sequence*>* getSequences() { return &_sequences; }
    inline std::vector<Class*>* getClasses() { return &_classes; }

    inline void setVideoView(VideoView* view) { _view = view; }

    inline int getNextSequenceId() { return (_nextSequenceId++); }
    inline void setNextSequenceId(int id) { _nextSequenceId = id; }

    inline int getNextObjectId() { return _nextObjectId++; }
    inline int getLastObjectId() { return _nextObjectId; }
    inline void setNextObjectId(int id) { _nextObjectId = id; }

    inline int getNextClassId() { return _nextClassId++; }
    inline void setNextClassId(int id) { _nextClassId = id; }

    void addSequence(Sequence* sequence);
    void addClass(Class* cls);

    void addClass(std::string clsName);

    void removeActiveSequence();
    void removeActiveClass();

    int getNegativeSampleClassId();

private:
    std::vector<Sequence*> _sequences;
    std::vector<Class*> _classes;

    Sequence* _activeSequence;
    Class* _activeClass;

    VideoView* _view;

    std::string _name;

    int _nextSequenceId;
    int _nextObjectId;
    int _nextClassId;

    ProjectType _projectType;
};

Q_DECLARE_METATYPE(Project*)

#endif // PROJECT_HXX